<template>
	<view class="page" :style="themeColor">
		<view class="flex benben-position-layout flex flex-wrap align-center appraiseData_flex_0"
			:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx'}">
			<view class='flex flex-wrap align-center justify-between flex-sub appraiseData_fd0_0'>
				<view class='flex flex-wrap align-center' @tap.stop="handleJumpDiy" data-type="back" data-url="1">
					<text class='fu-iconfont2  appraiseData_fd0_0_c0_c0'>&#xE794;</text>
				</view>
				<view class='flex flex-wrap align-stretch justify-center flex-sub'>
					<text class='appraiseData_fd0_0_c1_c0'>评价</text>
				</view>
				<view class='flex flex-wrap align-center appraiseData_fd0_0_c2'>
				</view>
			</view>

		</view>
		<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
		
		<view class="loading_css" v-if="!is_Show">
			<u-loading size="36" color="#6A0002"></u-loading>
			<view class="loading_text">加载中</view>
		</view>

		<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout appraiseData_flex_1" v-else>
			<view class='flex flex-direction flex-wrap align-stretch appraiseData_fd1_0'>
				<view class='flex flex-direction flex-wrap align-stretch appraiseData_fd1_0_c0'>
					<view class='flex flex-wrap align-center' v-for="(v, k) in order_goods" :eky="k">
						<image class='appraiseData_fd1_0_c0_c0_c0' mode="aspectFill" :src='v.goods_thumb'></image>
						<view class='flex flex-direction flex-wrap align-stretch flex-sub appraiseData_fd1_0_c0_c0_c1'>
							<text class='appraiseData_fd1_0_c0_c0_c1_c0'>{{v.goods_name}}</text>
							<view class='flex flex-wrap align-center appraiseData_fd1_0_c0_c0_c1_c1'>
								<text class='appraiseData_fd1_0_c0_c0_c1_c1_c0'>{{v.sku_name}}</text>
							</view>
							<view class='flex flex-wrap align-center'>
								<text class='appraiseData_fd1_0_c0_c0_c1_c2_c0'>￥</text>
								<view class=' appraiseData_fd1_0_c0_c0_c1_c2_c1'>
									<text
										class=' appraiseData_price1_fd1_0_c0_c0_c1_c2_c1'>{{ v.shop_price | frontPrice }}</text>
									<text
										class=' appraiseData_price2_fd1_0_c0_c0_c1_c2_c1'>{{ v.shop_price | laterPrice }}</text>
								</view>
								<view class='flex flex-wrap align-center appraiseData_fd1_0_c0_c0_c1_c2_c2'>
									<text class='appraiseData_fd1_0_c0_c0_c1_c2_c2_c0'>x</text>
									<text class='appraiseData_fd1_0_c0_c0_c1_c2_c2_c1'>{{v.num}}</text>
								</view>
							</view>
						</view>
					</view>
				</view>
				<view class='flex flex-wrap align-center justify-between appraiseData_fd1_0_c1'>
					<text class='appraiseData_fd1_0_c1_c0'>商品评价</text>
					<view class='flex flex-wrap align-center'>
						<template v-for="starNum in 5">
							<image @click="fd1_0_c1_c1 = starNum" v-if="fd1_0_c1_c1 >= starNum" :key="starNum"
								class='appraiseData_star1fd1_0_c1_c1' mode="aspectFit" :src='STATIC_URL+"111.png"'>
							</image>
							<image @click="fd1_0_c1_c1 = starNum" v-else :key="starNum"
								class='appraiseData_star1fd1_0_c1_c1' mode="aspectFit" :src='STATIC_URL+"112.png"'>
							</image>
						</template>
					</view>
				</view>
				<view class='flex flex-wrap appraiseData_fd1_0_c2'>
					<textarea class='flex appraiseData_input_fd1_0_c2' :placeholder="'请输入您的评价'"
						:maxlength="-1" :show-num='true'
						placeholder-style="color:rgba(153, 153, 153, 1);font-size:28rpx" v-model="fd1_0_c2" />
					<!-- <template>
						<view class='flex flex justify-end appraiseData_numberfd1_0_c2_c0'>
							<text>{{fd1_0_c2.length}}</text>
							<text>/</text>
							<text>240</text>
						</view>
					</template> -->
				</view>
				<view class='flex flex-direction flex-wrap align-stretch'>
					<view class='flex flex-wrap align-center appraiseData_fd1_0_c3_c0'>
						<text class='appraiseData_fd1_0_c3_c0_c0'>添加照片</text>
						<text class='appraiseData_fd1_0_c3_c0_c1'>最多可上传9张</text>
					</view>
					<benben-images-upload ref="benbenImagesUploadfd1_0_c3_c1" :maxlength="9" :img-list.sync="imgs"
						:img-ids.sync="thumb" :is-show-tips='true'>
						<template #content="{ num, maxlength, isShow, imgList }">
							<view class="flex flex-wrap align-stretch flex appraiseData_fd1_0_c3_c1">

								<view v-for="(image, index) in imgList" :key="index"
									class='flex position-relative appraiseData_fd1_0_c3_c10'>
									<text class='fu-iconfont2 position-absolute appraiseData_fd1_0_c3_c100'
										@tap.stop="$refs.benbenImagesUploadfd1_0_c3_c1.delImage(index)">&#xE8E7;</text>
									<image class='appraiseData_fd1_0_c3_c101'
										@tap.stop="$refs.benbenImagesUploadfd1_0_c3_c1.previewImage(index)"
										mode="aspectFill" :src='image'></image>
								</view>

								<image class='appraiseData_fd1_0_c3_c11'
									@tap.stop="$refs.benbenImagesUploadfd1_0_c3_c1.manyChooseImage()" v-if="isShow"
									mode="aspectFill" :src='STATIC_URL+"48.jpg"'></image>

							</view>
						</template>
					</benben-images-upload>
					<view class='flex flex-wrap align-center appraiseData_fd1_0_c3_c2'>
						<benben-flex-switch-new class-name='flex flex' v-model="is_tocke" :disabled='false'>
							<template v-slot:checked>

								<view class='flex flex position-relative align-center'>
									<image class='appraiseData_checkfd1_0_c3_c2_c0_c0_c0' mode="aspectFit"
										:src='STATIC_URL+"1.png"'></image>
								</view>

							</template>
							<template v-slot:unchecked>

								<view class='flex flex position-relative justify-end align-center'>
									<image class='appraiseData_noCheckfd1_0_c3_c2_c0_c1_c0' mode="aspectFit"
										:src='STATIC_URL+"51.png"'></image>
								</view>

							</template>
						</benben-flex-switch-new>
						<text class='appraiseData_fd1_0_c3_c2_c1'>匿名评价</text>
					</view>
				</view>
			</view>
		</view>

		<view class="flex flex-wrap align-start justify-center benben-position-layout flex appraiseData_flex_2">
			<button class='appraiseData_fd2_0' @tap.stop="SubmitEvent">提交</button>

		</view>
		<view :style="{height: '120rpx'}"></view>


	</view>
</template>
<script>
	export default {
		components: {},


		data() {
			return {
				"fd1_0_c1_c1": "5",
				"fd1_0_c2": "",
				"is_tocke": true,
				"order_sn": "",
				"detailsInfo": {},
				"order_goods": [],
				"isShow": false,
				"thumb": "",
				"imgs": [],
				"is_Show": false,
				"is_submit": false
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},

		},
		watch: {},
		onLoad(options) {
			let {
				order_sn
			} = options
			if (order_sn !== undefined) this.order_sn = order_sn
			this.DataDetailsFunc();
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			//获取订单详情
			DataDetailsFunc() {
				this.$api.post(global.apiUrls.post643d774973838, {
					order_sn: this.order_sn
				}).then(res => {
					this.is_Show = true;
					if (res.data.code == 1) {
						this.detailsInfo = res.data.data;
						this.order_goods = res.data.data.order_goods;
					} else {
						this.$message.info(res.data.msg);
					}
				})
			},
			
			SubmitEvent() {
				if (!this.fd1_0_c2) {
					this.$message.info('请输入您的评价');
					return;
				}
				if (this.is_submit) return; 
				this.is_submit = true;
				this.$api.post(global.apiUrls.post643e321ecc841, {
					order_sn: this.order_sn,
					stars: this.fd1_0_c1_c1,
					content: this.fd1_0_c2,
					is_unname: this.is_tocke ? 1 : 0,
					images: this.imgs.length > 0 ? this.imgs.join(',') : '',
				}).then(res => {
					this.$message.info(res.data.msg);
					if (res.data.code == 1) {
						setTimeout(() => {
							this.is_submit = false;
							uni.navigateBack();
						}, 800)
					} else {
						this.is_submit = false;
					}
				}).catch(err => {
					this.is_submit = false;
				})
			},
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: #F8F8F8;
		background-size: 100% auto !important;
	}

	.appraiseData_flex_0 {
		background: #fff;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.appraiseData_fd0_0_c2 {
		width: 32rpx;
		height: 32rpx;
	}

	.appraiseData_fd0_0_c1_c0 {
		font-size: 36rpx;
		font-weight: 500;
		color: #333333;
		line-height: 50rpx;
	}

	.appraiseData_fd0_0_c0_c0 {
		font-size: 32rpx;
		font-weight: 500;
		color: #333;
		line-height: 88rpx;
	}

	.appraiseData_fd0_0 {
		margin: 0rpx 32rpx 0rpx 32rpx;
	}

	.appraiseData_flex_1 {
		padding: 0rpx 24rpx 0rpx 24rpx;
	}

	.appraiseData_fd1_0_c3_c2_c1 {
		font-size: 24rpx;
		font-weight: 400;
		color: #666666;
		margin: 0rpx 0rpx 0rpx 16rpx;
	}

	.appraiseData_noCheckfd1_0_c3_c2_c0_c1_c0 {
		border-radius: 24rpx 24rpx 24rpx 24rpx;
		width: 32rpx;
		height: 32rpx;
	}

	.appraiseData_checkfd1_0_c3_c2_c0_c0_c0 {
		width: 32rpx;
		height: 32rpx;
		border-radius: 24rpx 24rpx 24rpx 24rpx;
	}

	.appraiseData_fd1_0_c3_c2 {
		margin: 24rpx 0rpx 0rpx 0rpx;
	}

	.appraiseData_fd1_0_c3_c11 {
		width: 160rpx;
		height: 160rpx;
		margin: 0rpx 24rpx 24rpx 0rpx;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
	}

	.appraiseData_fd1_0_c3_c101 {
		width: 160rpx;
		height: 160rpx;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
	}

	.appraiseData_fd1_0_c3_c100 {
		top: 0rpx;
		right: 0rpx;
		z-index: 10;
		color: #ff5536;
	}

	.appraiseData_fd1_0_c3_c10 {
		margin: 0rpx 24rpx 24rpx 0rpx;
	}

	.appraiseData_fd1_0_c3_c1 {
		width: 600rpx;
		padding: 20rpx 0rpx 0rpx 0rpx;
	}

	.appraiseData_fd1_0_c3_c0_c1 {
		margin: 0rpx 0rpx 0rpx 16rpx;
		line-height: 42rpx;
		font-size: 24rpx;
		font-weight: 400;
		color: #BFBFBF;
	}

	.appraiseData_fd1_0_c3_c0_c0 {
		line-height: 42rpx;
		font-size: 32rpx;
		font-weight: 400;
		color: #333333;
	}

	.appraiseData_fd1_0_c3_c0 {
		margin: 32rpx 0rpx 0rpx 0rpx;
	}

	.appraiseData_numberfd1_0_c2_c0 {
		width: 100%;
		font-size: 24rpx;
		color: #FFFFFF;
		line-height: 46rpx;
		font-weight: 400;
	}

	.appraiseData_input_fd1_0_c2 {
		width: 638rpx;
		height: 100%;
		font-size: 28rpx;
		font-weight: 400;
		color: #333;
		background: rgba(248, 248, 248, 1);
		padding: 16rpx;
	}

	.appraiseData_fd1_0_c2 {
		background: rgba(248, 248, 248, 1);
		width: 638rpx;
		border-radius: 10rpx 10rpx 10rpx 10rpx;
		height: 272rpx;
		padding: 10rpx 0rpx 10rpx 0rpx;
		margin: 32rpx 0rpx 0rpx 0rpx;
	}

	.appraiseData_star1fd1_0_c1_c1 {
		height: 34rpx;
		margin: 0rpx 5rpx 0rpx 5rpx;
		width: 34rpx;
	}

	.appraiseData_star1fd1_0_c1_c1 {
		width: 34rpx;
		height: 34rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		margin: 0rpx 5rpx 0rpx 5rpx;
	}

	.appraiseData_fd1_0_c1_c0 {
		font-size: 32rpx;
		font-weight: 400;
		color: #333333;
	}

	.appraiseData_fd1_0_c1 {
		border-bottom: 1px solid rgba(238, 238, 238, 1);
		height: 109rpx;
	}

	.appraiseData_fd1_0_c0_c0_c1_c2_c2_c1 {
		font-size: 24rpx;
		font-weight: 400;
		color: #999999;
	}

	.appraiseData_fd1_0_c0_c0_c1_c2_c2_c0 {
		font-size: 24rpx;
		font-weight: 400;
		color: #999999;
	}

	.appraiseData_fd1_0_c0_c0_c1_c2_c2 {
		margin: 0rpx 0rpx 0rpx auto;
	}

	.appraiseData_price2_fd1_0_c0_c0_c1_c2_c1 {
		font-size: 22rpx;
		font-weight: 700;
		color: #F02325;
		line-height: 27rpx;
	}

	.appraiseData_price1_fd1_0_c0_c0_c1_c2_c1 {
		font-size: 32rpx;
	}

	.appraiseData_fd1_0_c0_c0_c1_c2_c1 {
		color: #F02325;
		font-weight: 700;
		line-height: 32rpx;
		font-size: 32rpx;
	}

	.appraiseData_fd1_0_c0_c0_c1_c2_c0 {
		line-height: 20rpx;
		font-size: 20rpx;
		font-weight: 700;
		color: #F02325;
	}

	.appraiseData_fd1_0_c0_c0_c1_c1_c2 {
		font-size: 24rpx;
		font-weight: 400;
		color: #999999;
	}

	.appraiseData_fd1_0_c0_c0_c1_c1_c1 {
		font-size: 24rpx;
		font-weight: 400;
		color: #999999;
	}

	.appraiseData_fd1_0_c0_c0_c1_c1_c0 {
		font-size: 24rpx;
		font-weight: 400;
		color: #999999;
		max-width: 200rpx;
		-webkit-line-clamp: 1;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
	}

	.appraiseData_fd1_0_c0_c0_c1_c1 {
		margin: 8rpx 0rpx 21rpx 0rpx;
	}

	.appraiseData_fd1_0_c0_c0_c1_c0 {
		font-size: 28rpx;
		font-weight: 500;
		color: #333333;
	}

	.appraiseData_fd1_0_c0_c0_c1 {
		margin: 0rpx 0rpx 0rpx 16rpx;
	}

	.appraiseData_fd1_0_c0_c0_c0 {
		width: 200rpx;
		height: 200rpx;
	}

	.appraiseData_fd1_0_c0 {
		border-bottom: 1px solid rgba(238, 238, 238, 1);
		margin: 16rpx 0rpx 0rpx 0rpx;
		padding: 0rpx 0rpx 32rpx 0rpx;
	}

	.appraiseData_fd1_0 {
		background: #FFFFFF;
		margin: 24rpx 0rpx 0rpx 0rpx;
		width: 686rpx;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		padding: 16rpx 24rpx 32rpx 24rpx;
	}

	.appraiseData_flex_2 {
		width: 750rpx;
		height: 120rpx;
		overflow: hidden;
		z-index: 10;
		bottom: calc(0rpx + var(--window-bottom));
	}

	.appraiseData_fd2_0 {
		background: #6A0002;
		border-radius: 40rpx 40rpx 40rpx 40rpx;
		font-size: 32rpx;
		color: #fff;
		width: 686rpx;
		height: 80rpx;
		line-height: 80rpx;
		font-weight: 500;
	}
</style>